<?php

use yii\helpers\Html;
use app\common\widgets\MyDetailView;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model app\models\Msg */

$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => '消息', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="msg-view">
    <div class="bg-info" style="width: 100%;height: 80px;border:1px solid #ddd;border-radius: 3px;">
        <p class="text-primary"style=" color: #0066cc;font-size: 20px;margin-left: 10px;">消息一览</p>
        <div style="float: right;">
            <?php // echo Html::a('更新', ['update', 'id' => $model->id], ['class' => 'btn btn-info','style' => 'margin-right:5px']) ?>
            <?= Html::a('新建', ['create'], ['class' => 'btn btn-info', 'style' => 'margin-right:5px']) ?>
            <?= Html::a('返回', ['index'], ['class' => 'btn btn-info', 'style' => 'margin-right:10px']) ?>
        </div>
    </div>




    <?=
    MyDetailView::widget([
        'model' => $model,
        'attributes' => [
            // 'id',
            'msgtype',
//            'isforward',
//            'forwardid',
            'title',
            'description',
            'content',
//            'addman',
//            'addmanid',
//            'addtime',
//            'isfinish',
//            [
//                'attribute' => 'isfinish',
//                'value' => $model->isfinish == 1 ? '是' : '否',
//            ],
            'sendtime',
            'meetingtime_start',
            'meetingtime_end',
            'meetingplace',
        ],
    ])
    ?>

    <div class="row">

        <div class="form-group">
            <label class="col-lg-2 control-label"><h4>接收对象</h4></label>
            <ul class="list-unstyled project-files col-lg-12">
                <?php
                $s = $model->msgUsers;

                foreach ($model->msgUsers as $msgUser) {
                    ?>
                    <li class="col-lg-2"  style="float:left">
                        <?php
                        if ($msgUser->user) {
                            echo $msgUser->user->name;
                        }
                        ?>


                    </li>

                    <?php
                }
                ?>

            </ul>

        </div>
    </div>

    <div class="row">

<?php if ($model->upfiles != null) {
    ?>
            <div class="form-group">
                <label class="col-lg-2 control-label"><h4>已有文档</h4></label>
                <ul class="list-unstyled project-files col-lg-12">
                    <?php
                    foreach ($model->upfiles as $document) {
                        ?>
                        <li class="col-lg-2"  style="float:left">
                            <div class="media">
                                <div class="media-left">
                                    <a href="<?= $document->filepath ?>">
                                        <?php
                                        $path = $document->filepath;
                                        $filetyep = strtolower(substr($path, strrpos($path, '.') + 1));

                                        if ($filetyep == "xls" || $filetyep == "xlsx") {
                                            ?>
                                            <img class="media-object" src="img/excel.png" alt="..." style="width:50px;height:50px;">
                                            <?php
                                        } else if ($filetyep == "doc" || $filetyep == "docx") {
                                            ?>
                                            <img class="media-object" src="img/word.jpg" alt="..." style="width:50px;height:50px;">
                                            <?php
                                        } else if ($filetyep == "ppt" || $filetyep == "pptx") {
                                            ?>
                                            <img class="media-object" src="img/ppt.png" alt="..." style="width:50px;height:50px;">
                                            <?php
                                        } else if ($filetyep == "txt") {
                                            ?>
                                            <img class="media-object" src="img/text.png" alt="..." style="width:50px;height:50px;">
                                            <?php
                                        } else if ($filetyep == "png" || $filetyep == "jpg" || $filetyep == "jpeg" || $filetyep == "bmp" || $filetyep == "gif") {
                                            ?>
                                            <!--<img class="media-object" src="img/zhaopian.png" alt="..." style="width:50px;height:50px;">-->
                                            <img class="media-object" src="<?= $path ?>" alt="..." style="width:50px;height:50px;">
                                            <?php
                                        } else {
                                            ?>
                                            <img class="media-object" src="img/file.png" alt="..." style="width:50px;height:50px;">
                                            <?php
                                        }
                                        ?>

                                    </a>
                                </div>
                            </div>
                            <a href="<?= $path ?>"><?= $document->filename ?></a>
                        </li>

                        <?php
                    }
                    ?>
                </ul>

            </div>

<?php } ?>

    </div>





</div>
